package consumer

import (
	"code.bydev.io/frameworks/byone/core/service"
	"flag"
	"fmt"

	"code.bydev.io/frameworks/byone/core/conf"

	"code.bydev.io/cht/customer/kyc_admin_service/service/consumer/internal/config"
	"code.bydev.io/cht/customer/kyc_admin_service/service/consumer/internal/handler"
	"code.bydev.io/cht/customer/kyc_admin_service/service/consumer/internal/svc"
)

var configFile = flag.String("consumer_config", "../conf/consumer.toml", "the config file")

func ConsumerService() *service.ServiceGroup {
	var c config.Config
	conf.MustLoad(*configFile, &c)
	c.MustSetUp()

	ctx := svc.NewServiceContext(c)
	consumer := handler.Init(ctx)
	fmt.Println("Starting consumer service...")
	return consumer
}
